/*
* 复检添加
* */

import 'dart:convert';

import 'package:center_beijing/api/product_api.dart';
import 'package:center_beijing/api/task_api.dart';
import 'package:center_beijing/common/logutil.dart';
import 'package:center_beijing/common/notification.dart';
import 'package:center_beijing/common/styles.dart';
import 'package:center_beijing/common/utils.dart';
import 'package:center_beijing/config/global_config.dart';
import 'package:center_beijing/widgets/custom_input_widget.dart';
import 'package:center_beijing/widgets/custom_loading_widget.dart';
import 'package:center_beijing/widgets/imageSelect_widget.dart';
import 'package:center_beijing/widgets/imagesWatch_widget2.dart';
import 'package:center_beijing/widgets/photo_view_gallery.dart';
import 'package:center_beijing/widgets/textarea_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:get/get.dart' as Go;
import 'package:dio/dio.dart' as ImageForm;
import 'package:images_picker/images_picker.dart';
import 'package:left_scroll_actions/cupertinoLeftScroll.dart';
import 'package:left_scroll_actions/global/actionListener.dart';
import 'dart:io';
import 'package:http_parser/http_parser.dart';
class ProblemRecheck extends StatefulWidget {
  @override
  _ProblemRecheckState createState() => _ProblemRecheckState();
}

class _ProblemRecheckState extends State<ProblemRecheck>
    with SingleTickerProviderStateMixin {
  AnimationController _controller;
  var businessId = Go.Get.arguments['businessId'];
  var taskId = Go.Get.arguments['taskId'];
  CustomLoading loading = CustomLoading.withMessage('提交中...');

  final TextEditingController standardRegulations =
  TextEditingController(); //引用标准/条例
  final TextEditingController rectificationTime =
  TextEditingController(); //限定整改日期
  final TextEditingController initiator = TextEditingController(); //发起人

  var baseDetail = Map();
  List flowList = [];

  /*
  * 责任信息
  * */
  final TextEditingController workArea = TextEditingController(); //工区
  final TextEditingController person = TextEditingController(); //责任人
  final TextEditingController punishmentTeam = TextEditingController(); //处罚班组
  final TextEditingController punishmentTeamInfo =
  TextEditingController(); //处罚班组信息

  var remark = ''; //完成情况

  List punishmentPersonInfoList = [];
  var imgUrl = '';
  bool hide = true;
  List imgs = [];
  List<Media> photos = [];
  ImageForm.FormData formData;
  List passPhoto = [];

  bool hide2 = true;

  @override
  void initState() {
    _controller = AnimationController(vsync: this);
    super.initState();

    this.getDetail();
    this.getFlowDetail();
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  /*
  * 获取问题详情
  * */
  getDetail() async {
    var result = await getQsProblemDetail({'id': businessId});
    if (result != null) {
      if(result['photoFiles']['1']!=null){
        result['photoFiles']['1'].forEach((item) {
          imgs.add(
              "${GlobalConfig.baseUrl}fs/irest/file/mps_fileTransferHandler/image?id=${item['photoId']}&ZJQFSESSION=${GlobalConfig.session}");
        });
      }
      this.setState(() {
        baseDetail = result;

        standardRegulations.text = baseDetail['qsIssueType'] != null
            ? baseDetail['qsIssueType']['name']
            : '--';
        rectificationTime.text = baseDetail['qsCheckRecord'] != null
            ? baseDetail['qsCheckRecord']['deadlineDateStr']
            : '--';
        punishmentPersonInfoList = baseDetail['qsIssuePersonList'] != null
            ? baseDetail['qsIssuePersonList']
            : [];
        punishmentTeamInfo.text = baseDetail['qsCheckRecord'] != null
            ? baseDetail['qsCheckRecord']['punishmentTypeCaption']
            : '--';

      });
    }
    LogUtil.d(result);
  }

  /*
  * 获取流程详情
  * */
  getFlowDetail() async {
    var result = await getProblemDetail({'id': businessId});
    if (result != null) {
      this.setState(() {
        person.text = result['leaderName']!=null?result['leaderName']:'--';
        workArea.text = result['workAreaName']!=null?result['workAreaName']:'--';
        initiator.text = result['list'][0]['updateUserName'];
        flowList = result['list'];
        punishmentTeam.text = result['workerTeamName']!=null?result['workerTeamName']:'--';
      });
    }
    LogUtil.d(result);
  }

  Future addImage(status) async {
    this.passPhoto = [];
    loading.show(delay: 30);
    if (this.photos.length > 0) {
      var temPhotos = [];
      temPhotos.addAll(this.photos);
      formData = new ImageForm.FormData.fromMap({
        "tenantId": GlobalConfig.tenantId,
      });
      for (int i = 0; i < temPhotos.length; i++) {
        Media asset = temPhotos[i];
        File file = File(asset.path);
        formData.files.add(MapEntry("files",
            await ImageForm.MultipartFile.fromFile(file.path.toString(),contentType: MediaType('image',file.path.toString().split('.').last))));
      }
      var result = await uploadImage(formData, GlobalConfig.tenantId);
      if (result != null && result.length > 0) {
        this.passPhoto = result;
        this.submit(status);
      }
    } else {
      this.submit(status);
    }
  }

  submit(status) async {
    baseDetail['qsCheckRecord']['remark'] = remark;
    baseDetail['qsCheckRecord']['issueStatus'] = status;
    baseDetail['photoIds'] = passPhoto.map((e) {
      return e['attachmentId'];
    }).toList();
    var pass = {
      'tenantId': GlobalConfig.tenantId,
      'taskId': taskId,
      'executorList': json.encode(baseDetail['elements']),
      'param': json.encode(baseDetail)
    };
    var result = await submitQsCheckRecord(pass);
    loading.dismiss();
    if (result['text'] != null && result['text'] == '') {
      Fluttertoast.showToast(msg: '提交成功');
      bus.emit('refreshHome');
      Go.Get.back();
    }
    // LogUtil.d(result);
  }

  getFlowItemStatus(reviseBeforeStatus, reviseAfterStatus) {
    if ((reviseBeforeStatus == '0' && reviseAfterStatus == '0') ||
        (reviseBeforeStatus == '0' && reviseAfterStatus == '1') ||
        (reviseBeforeStatus == '1' && reviseAfterStatus == '1') ||
        (reviseBeforeStatus == '0' && reviseAfterStatus == '') ||
        (reviseBeforeStatus == '0' && reviseAfterStatus == null) ||
        (reviseBeforeStatus == '1' && reviseAfterStatus == null)) {
      return '发';
    } else if ((reviseBeforeStatus == '2' && reviseAfterStatus == '3') ||
        (reviseBeforeStatus == '3' && reviseAfterStatus == '3')) {
      return '整';
    } else if (reviseBeforeStatus == '3' && reviseAfterStatus == '2') {
      return '复';
    } else if (reviseBeforeStatus == '3' && reviseAfterStatus == '4') {
      return '复';
    } else {
      return '';
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('复检'),
        ),
        body: Container(
          color: Styles.MainBackgroundColor,
          padding: EdgeInsets.fromLTRB(
              0, 0, 0, MediaQuery.of(context).padding.bottom + 70),
          child: GestureDetector(
            onTap: (){
              FocusScope.of(context).requestFocus(FocusNode());
            },
            child: Column(
              children: [
                Container(
                  padding: EdgeInsets.fromLTRB(Styles.spacing8, Styles.spacing8,
                      Styles.spacing8, Styles.spacing8),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Row(
                        children: [
                          Container(
                            height: 26.h,
                            width: 4,
                            color: Styles.BlueColor,
                            margin: EdgeInsets.only(right: Styles.spacing8),
                          ),
                          Text(
                            '基本信息',
                            style: TextStyle(
                                color: Styles.DetailColor,
                                fontSize: Styles.Middle16Font),
                          ),
                        ],
                      ),
                    ],
                  ),
                ),
                Container(
                  color: Colors.white,
                  padding: EdgeInsets.fromLTRB(Styles.spacing8, Styles.spacing8,
                      Styles.spacing8, Styles.spacing8),
                  child: Row(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: [
                      imgs.length > 0?GestureDetector(
                        onTap:(){
                          Navigator.of(context).push(new FadeRoute(
                              page: PhotoViewGalleryScreen(
                                  images: imgs, //传入图片list
                                  index: 0, //传入当前点击的图片的index
                                  heroTag: '')));
                        },
                        child: Container(
                          child: Image.network(
                            imgs[0],
                            height: 80.h,
                            width: 80.w,
                            fit: BoxFit.fill,
                          ),
                        ),
                      ):Container(child: Image.asset(
                        'assets/images/default_image.png',
                        height: 80.h,
                        width: 80.w,
                        fit: BoxFit.fill,
                      )),
                      Expanded(child: Container(
                        alignment: Alignment.centerLeft,
                        margin: EdgeInsets.fromLTRB(
                            Styles.spacing8, 0, Styles.spacing8, 0),
                        child: Text(
                          (baseDetail['qsCheckRecord'] != null &&
                              baseDetail['qsCheckRecord']['summary'] != null)
                              ? baseDetail['qsCheckRecord']['summary']
                              : '--',
                          style: TextStyle(
                              color: Styles.LeftTitleColor,
                              fontSize: Styles.NormalFont),
                        ),
                      )),
                    ],
                  ),
                ),
                Container(
                  color: Colors.white,
                  alignment: Alignment.centerLeft,
                  padding: EdgeInsets.fromLTRB(Styles.spacing8, Styles.spacing4,
                      Styles.spacing8, Styles.spacing4),
                  child: Text(
                      '问题发现时间   ${baseDetail['qsCheckRecord'] != null ? baseDetail['qsCheckRecord']['recordCreateTimeStr'] : ''}'),
                ),
                Expanded(
                    child: SingleChildScrollView(
                      child: Column(
                        children: [
                          Container(
                            padding: EdgeInsets.fromLTRB(Styles.spacing8,
                                Styles.spacing8, Styles.spacing8, Styles.spacing8),
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Row(
                                  children: [
                                    Container(
                                      height: 26.h,
                                      width: 4,
                                      color: Styles.BlueColor,
                                      margin: EdgeInsets.only(right: Styles.spacing8),
                                    ),
                                    Text(
                                      '构件信息',
                                      style: TextStyle(
                                          color: Styles.DetailColor,
                                          fontSize: Styles.Middle16Font),
                                    ),
                                  ],
                                ),
                              ],
                            ),
                          ),
                          this.baseDetail['elements']!=null?Column(
                            children: this.baseDetail['elements'].map<Widget>((item){
                              return Container(
                                alignment: Alignment.centerLeft,
                                color: Colors.white,
                                padding: EdgeInsets.fromLTRB(
                                    Styles.spacing16,
                                    Styles.spacing8,
                                    Styles.spacing8,
                                    Styles.spacing8),
                                margin: EdgeInsets.only(top: Styles.spacing8),
                                child: Column(
                                  children: [
                                    Container(
                                      alignment: Alignment.centerLeft,
                                      child: Text(
                                        item['compKindName']!=null
                                            ? item['compKindName']
                                            : '--',
                                        style: TextStyle(
                                            color: Styles.DetailColor,
                                            fontSize: Styles.Middle16Font),
                                      ),
                                    ),
                                    Container(
                                      alignment: Alignment.centerLeft,
                                      child: Text(
                                        item['code'] != null
                                            ? item['code']
                                            : '--',
                                        style: TextStyle(
                                            color: Styles.DetailColor,
                                            fontSize: Styles.Middle16Font),
                                      ),
                                    )
                                  ],
                                ),
                              );
                            }).toList(),
                          ):Container(),
                          Container(
                            padding: EdgeInsets.fromLTRB(Styles.spacing8,
                                Styles.spacing16, Styles.spacing8, Styles.spacing16),
                            child: Row(
                              children: [
                                Container(
                                  height: 26.h,
                                  width: 4,
                                  color: Styles.BlueColor,
                                  margin: EdgeInsets.only(right: Styles.spacing8),
                                ),
                                Text(
                                  '人员处罚信息',
                                  style: TextStyle(
                                      color: Styles.DetailColor,
                                      fontSize: Styles.Middle16Font),
                                ),
                              ],
                            ),
                          ),
                          Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: punishmentPersonInfoList.map((e) {
                              return Container(
                                color: Colors.white,
                                alignment: Alignment.centerLeft,
                                padding: EdgeInsets.fromLTRB(
                                    Styles.spacing8,
                                    Styles.spacing8,
                                    Styles.spacing8,
                                    Styles.spacing8),
                                child: Text(
                                    "${e['workerName']}  ${Utils.getPunishmentType(e['punishmentType'])}  扣分${e['workerScore']}"),
                              );
                            }).toList(),
                          ),
                          Container(
                            color: Colors.white,
                            margin: EdgeInsets.fromLTRB(0, Styles.spacing8, 0, 0),
                            padding: EdgeInsets.fromLTRB(
                                Styles.spacing8, 0, Styles.spacing8, 0),
                            child: TextAreaWidget(
                              maxLength: 100,
                              labelText: '完成情况',
                              defaultValue: '',
                              placeholder: '请输入完成情况',
                              disabled: false,
                              required: true,
                              rows: 4,
                              onChange: (value) => this.setState(() {
                                remark = value;
                              }),
                            ),
                          ),
                          Container(
                            margin: EdgeInsets.fromLTRB(0, Styles.spacing8, 0, 0),
                            color: Colors.white,
                            child: Column(
                              children: [
                                Padding(
                                  padding: EdgeInsets.fromLTRB(
                                      Styles.spacing16, Styles.spacing8, 0, 0),
                                  child: Row(
                                    children: <Widget>[
                                      Text(
                                        '照片(${this.photos.length}/6)',
                                        style: TextStyle(
                                            color: Styles.DetailColor,
                                            fontSize: Styles.MiddleFont17),
                                      ),
                                    ],
                                  ),
                                ),
                                ImageSelectWidget(
                                  onchange: (value) {
                                    this.setState(() {
                                      photos = value;
                                    });
                                  },
                                ),
                              ],
                            ),
                          ),
                          Container(
                            padding: EdgeInsets.fromLTRB(Styles.spacing8,
                                Styles.spacing8, Styles.spacing8, Styles.spacing8),
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Row(
                                  children: [
                                    Container(
                                      height: 26.h,
                                      width: 4,
                                      color: Styles.BlueColor,
                                      margin: EdgeInsets.only(right: Styles.spacing8),
                                    ),
                                    Text(
                                      '整改记录',
                                      style: TextStyle(
                                          color: Styles.DetailColor,
                                          fontSize: Styles.Middle16Font),
                                    ),
                                  ],
                                ),
                              ],
                            ),
                          ),
                          Column(
                            children: flowList.map((item) {
                              var status = this.getFlowItemStatus(
                                  item['reviseBeforeStatus'],
                                  item['reviseAfterStatus']);
                              return status == ''
                                  ? Container()
                                  : Container(
                                padding: EdgeInsets.fromLTRB(
                                    Styles.spacing8, 0, Styles.spacing8, 0),
                                margin: EdgeInsets.fromLTRB(
                                    0, Styles.spacing4, 0, Styles.spacing4),
                                child: Row(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: [
                                    Container(
                                      padding: EdgeInsets.all(Styles.spacing8),
                                      decoration: BoxDecoration(
                                        color: status == '发'
                                            ? Styles.BlueColor
                                            : (status == '整'
                                            ? Styles.OrangeColor
                                            : (status == '复'
                                            ? Styles.PurpleColor
                                            : Styles.GreenColor)),
                                        shape: BoxShape.circle,
                                      ),
                                      child: Text(
                                        status,
                                        style: TextStyle(
                                            color: Styles.ShareWhite,
                                            fontSize: Styles.NormalFont),
                                      ),
                                    ),
                                    Expanded(
                                        child: Container(
                                          padding: EdgeInsets.all(Styles.spacing8),
                                          margin: EdgeInsets.fromLTRB(
                                              Styles.spacing8,
                                              0,
                                              Styles.spacing8,
                                              0),
                                          decoration: BoxDecoration(
                                              color: Styles.GrayLight,
                                              borderRadius: BorderRadius.all(
                                                  Radius.circular(4.0.r)),
                                              border: Border.all(
                                                  width: 1,
                                                  color: Styles.LineColor)),
                                          child: Column(
                                            crossAxisAlignment:
                                            CrossAxisAlignment.start,
                                            children: [
                                              Row(
                                                mainAxisAlignment:
                                                MainAxisAlignment.spaceBetween,
                                                children: [
                                                  Text(
                                                      '由${item['updateUserName']}在${item['recordUpdateTimeStr']}操作',
                                                      style: TextStyle(
                                                          color: Styles.DetailColor,
                                                          fontSize:
                                                          Styles.NormalFont)),
                                                  status=='发'?Container():GestureDetector(
                                                    onTap: () {
                                                      this.setState(() {
                                                        item['hide'] = item['hide']==null?false:!item['hide'];
                                                      });
                                                    },
                                                    child: Container(
                                                      padding: EdgeInsets.only(
                                                          right: Styles.spacing8),
                                                      child: Text(
                                                        (item['hide']==null||item['hide']) ? '查看' : '收起',
                                                        style: TextStyle(
                                                            color: Styles.BlueColor,
                                                            fontSize:
                                                            Styles.NormalFont),
                                                      ),
                                                    ),
                                                  )
                                                ],
                                              ),
                                              status!='发'&&item['hide']!=null&&!item['hide']
                                                  ? Column(
                                                crossAxisAlignment:
                                                CrossAxisAlignment.start,
                                                children: [
                                                  Container(
                                                    padding:
                                                    EdgeInsets.fromLTRB(
                                                        0,
                                                        Styles.spacing8,
                                                        0,
                                                        Styles.spacing8),
                                                    child: Text(
                                                      status=='整'?'整改情况':'复检情况',
                                                      style: TextStyle(
                                                          color: Styles
                                                              .DetailColor,
                                                          fontSize: Styles
                                                              .NormalFont),
                                                    ),
                                                  ),
                                                  Container(
                                                    padding:
                                                    EdgeInsets.fromLTRB(
                                                        0,
                                                        0,
                                                        0,
                                                        Styles.spacing8),
                                                    child: Text(
                                                      item['summary'],
                                                      style: TextStyle(
                                                          color: Styles
                                                              .LeftTitleColor,
                                                          fontSize: Styles
                                                              .NormalFont),
                                                    ),
                                                  ),
                                                  item['list']!=null&&item['list'].length>0?Column(
                                                    crossAxisAlignment: CrossAxisAlignment.start,
                                                    children: [
                                                      Container(
                                                        padding:
                                                        EdgeInsets.fromLTRB(
                                                            0,
                                                            Styles.spacing8,
                                                            0,
                                                            Styles.spacing8),
                                                        child: Text(
                                                          status=='整'?'整改照片':'复检照片',
                                                          style: TextStyle(
                                                              color: Styles
                                                                  .DetailColor,
                                                              fontSize: Styles
                                                                  .NormalFont),
                                                        ),
                                                      ),
                                                      ImagesWatchWidget2(
                                                        photos: item['list']
                                                            .map<String>((image) {
                                                          return "${GlobalConfig.baseUrl}fs/irest/file/mps_fileTransferHandler/image?id=${image['photoId']}&ZJQFSESSION=${GlobalConfig.session}";
                                                        }).toList(),
                                                      )
                                                    ],
                                                  ):Container(),

                                                ],
                                              )
                                                  : Container(),
                                            ],
                                          ),
                                        ))
                                  ],
                                ),
                              );
                            }).toList(),
                          ),
                          Container(
                            padding: EdgeInsets.fromLTRB(Styles.spacing8,
                                Styles.spacing8, Styles.spacing8, Styles.spacing8),
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Row(
                                  children: [
                                    Container(
                                      height: 26.h,
                                      width: 4,
                                      color: Styles.BlueColor,
                                      margin: EdgeInsets.only(right: Styles.spacing8),
                                    ),
                                    Text(
                                      '其他信息',
                                      style: TextStyle(
                                          color: Styles.DetailColor,
                                          fontSize: Styles.Middle16Font),
                                    ),
                                  ],
                                ),
                                GestureDetector(
                                  onTap: () {
                                    this.setState(() {
                                      hide = !hide;
                                    });
                                  },
                                  child: Container(
                                    padding: EdgeInsets.only(right: Styles.spacing8),
                                    child: Text(
                                      hide ? '展开' : '收起',
                                      style: TextStyle(
                                          color: Styles.BlueColor,
                                          fontSize: Styles.NormalFont),
                                    ),
                                  ),
                                )
                              ],
                            ),
                          ),
                          hide
                              ? Container()
                              : Column(
                            children: [
                              Container(
                                color: Colors.white,
                                margin: EdgeInsets.fromLTRB(
                                    0, Styles.spacing8, 0, 0),
                                padding: EdgeInsets.fromLTRB(
                                    Styles.spacing8, 0, Styles.spacing8, 0),
                                child: CustomInput(
                                  inputformat: [
                                    LengthLimitingTextInputFormatter(20)
                                  ],
                                  title: '引用标准/条例',
                                  placeHold: '请输入',
                                  textInput: this.standardRegulations,
                                  clearAll: false,
                                  require: false,
                                  readOnly: true,
                                ),
                              ),
                              Container(
                                color: Colors.white,
                                margin: EdgeInsets.fromLTRB(
                                    0, Styles.spacing8, 0, 0),
                                padding: EdgeInsets.fromLTRB(
                                    Styles.spacing8, 0, Styles.spacing8, 0),
                                child: Row(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: [
                                    Container(
                                      color: Colors.white,
                                      margin: EdgeInsets.fromLTRB(
                                          0, Styles.spacing8, 0, 0),
                                      padding: EdgeInsets.fromLTRB(
                                          Styles.spacing8, 0, Styles.spacing8, 0),
                                      child: Text(
                                        '整改要求',style: TextStyle(color: Styles.DetailColor,fontSize: Styles.MiddleFont17),
                                      ),
                                    ),
                                    Expanded(child: Container(
                                      color: Colors.white,
                                      margin: EdgeInsets.fromLTRB(
                                          0, Styles.spacing8, 0, 0),
                                      padding: EdgeInsets.fromLTRB(
                                          Styles.spacing8, 0, Styles.spacing8, 0),
                                      child: Text(
                                        baseDetail['qsCheckRecord'] != null
                                            ? baseDetail['qsCheckRecord']['rectifyAsk']
                                            : '--',style: TextStyle(color: Styles.TitleColor,fontSize: Styles.MiddleFont17),
                                      ),
                                    ))
                                  ],
                                ),
                              ),
                              Container(
                                color: Colors.white,
                                margin: EdgeInsets.fromLTRB(
                                    0, Styles.spacing8, 0, 0),
                                padding: EdgeInsets.fromLTRB(
                                    Styles.spacing8, 0, Styles.spacing8, 0),
                                child: CustomInput(
                                  inputformat: [
                                    LengthLimitingTextInputFormatter(20)
                                  ],
                                  title: '限定整改日期',
                                  placeHold: '请输入',
                                  textInput: this.rectificationTime,
                                  clearAll: false,
                                  require: false,
                                  readOnly: true,
                                ),
                              ),
                              Container(
                                color: Colors.white,
                                margin: EdgeInsets.fromLTRB(
                                    0, Styles.spacing8, 0, 0),
                                padding: EdgeInsets.fromLTRB(
                                    Styles.spacing8, 0, Styles.spacing8, 0),
                                child: CustomInput(
                                  inputformat: [
                                    LengthLimitingTextInputFormatter(20)
                                  ],
                                  title: '发起人',
                                  placeHold: '请输入',
                                  textInput: this.initiator,
                                  clearAll: false,
                                  require: false,
                                  readOnly: true,
                                ),
                              ),
                              Container(
                                padding: EdgeInsets.fromLTRB(
                                    Styles.spacing8,
                                    Styles.spacing8,
                                    Styles.spacing8,
                                    Styles.spacing8),
                                child: Row(
                                  children: [
                                    Container(
                                      height: 26.h,
                                      width: 4,
                                      color: Styles.BlueColor,
                                      margin: EdgeInsets.only(
                                          right: Styles.spacing8),
                                    ),
                                    Text(
                                      '责任信息',
                                      style: TextStyle(
                                          color: Styles.DetailColor,
                                          fontSize: Styles.Middle16Font),
                                    ),
                                  ],
                                ),
                              ),
                              Container(
                                color: Colors.white,
                                margin: EdgeInsets.fromLTRB(
                                    0, Styles.spacing8, 0, 0),
                                padding: EdgeInsets.fromLTRB(
                                    Styles.spacing8, 0, Styles.spacing8, 0),
                                child: CustomInput(
                                  inputformat: [
                                    LengthLimitingTextInputFormatter(20)
                                  ],
                                  title: '责任工区',
                                  placeHold: '请输入',
                                  textInput: this.workArea,
                                  clearAll: false,
                                  require: false,
                                  readOnly: true,
                                ),
                              ),
                              Container(
                                color: Colors.white,
                                margin: EdgeInsets.fromLTRB(
                                    0, Styles.spacing8, 0, 0),
                                padding: EdgeInsets.fromLTRB(
                                    Styles.spacing8, 0, Styles.spacing8, 0),
                                child: CustomInput(
                                  inputformat: [
                                    LengthLimitingTextInputFormatter(20)
                                  ],
                                  title: '责任人',
                                  placeHold: '请输入',
                                  textInput: this.person,
                                  clearAll: false,
                                  require: false,
                                  readOnly: true,
                                ),
                              ),
                              Container(
                                color: Colors.white,
                                margin: EdgeInsets.fromLTRB(
                                    0, Styles.spacing8, 0, 0),
                                padding: EdgeInsets.fromLTRB(
                                    Styles.spacing8, 0, Styles.spacing8, 0),
                                child: CustomInput(
                                  inputformat: [
                                    LengthLimitingTextInputFormatter(20)
                                  ],
                                  title: '处罚班组',
                                  placeHold: '请输入',
                                  textInput: this.punishmentTeam,
                                  clearAll: false,
                                  require: false,
                                  readOnly: true,
                                ),
                              ),
                              Container(
                                color: Colors.white,
                                margin: EdgeInsets.fromLTRB(
                                    0, Styles.spacing8, 0, 0),
                                padding: EdgeInsets.fromLTRB(
                                    Styles.spacing8, 0, Styles.spacing8, 0),
                                child: CustomInput(
                                  inputformat: [
                                    LengthLimitingTextInputFormatter(20)
                                  ],
                                  title: '班组处罚信息',
                                  placeHold: '请输入',
                                  textInput: this.punishmentTeamInfo,
                                  clearAll: false,
                                  require: false,
                                  readOnly: true,
                                ),
                              ),
                            ],
                          )
                        ],
                      ),
                    ))
              ],
            ),
          ),
        ),
        floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
        floatingActionButton: Container(
          color: Colors.white,
          padding: EdgeInsets.fromLTRB(
              Styles.spacing8, Styles.spacing8, Styles.spacing8, 10),
          child: Row(
            children: [
              Expanded(
                  flex: 1,
                  child: Container(
                    decoration: new BoxDecoration(
                      border:
                      Border.all(width: 1, color: Styles.BlueColor),
                      //背景
                      color: Styles.LightBlueColor,
                      //设置四周圆角 角度
                      borderRadius:
                      BorderRadius.all(Radius.circular(12.0)),
                    ),
                    margin: EdgeInsets.fromLTRB(
                        Styles.spacing8, 0, Styles.spacing8, 0),
                    child: FlatButton(
                        onPressed: () {
                          FocusScope.of(context).requestFocus(new FocusNode());
                          if(remark==''){
                            Fluttertoast.showToast(msg: '请输入完成情况');
                          }else{
                            showDialog(
                                barrierDismissible: false,
                                context: this.context,
                                builder: (BuildContext context) {
                                  return AlertDialog(
                                    title: Text('注意'),
                                    content: Text('确认通过吗？'),
                                    actions: <Widget>[
                                      new Container(
                                        child: FlatButton(
                                          child: new Text(
                                            "取消",
                                            style: TextStyle(color: Colors.black),
                                          ),
                                          onPressed: () {
                                            Navigator.pop(context);
                                          },
                                        ),
                                      ),
                                      new Container(
                                        child: FlatButton(
                                          child: new Text(
                                            "确定",
                                            style: TextStyle(color: Colors.red),
                                          ),
                                          onPressed: () {
                                            Navigator.pop(context);

                                            this.addImage('4');
                                          },
                                        ),
                                      ),
                                    ],
                                  );
                                });
                          }

                        },
                        child: Container(
                          height: Styles.MainButtonHeight,
                          alignment: Alignment.center,
                          child: Text('通过复检',
                              style: TextStyle(
                                  color: Styles.BlueColor,
                                  fontSize: Styles.MainButtonTextFont)),
                        )),
                  )),
              Expanded(
                  flex: 1,
                  child: Container(
                    decoration: new BoxDecoration(
                      border:
                      Border.all(width: 1, color: Styles.RedColor),
                      //背景
                      color: Colors.white,
                      //设置四周圆角 角度
                      borderRadius:
                      BorderRadius.all(Radius.circular(12.0)),
                    ),
                    margin: EdgeInsets.fromLTRB(
                        Styles.spacing8, 0, Styles.spacing8, 0),
                    child: FlatButton(
                        onPressed: () {
                          FocusScope.of(context).requestFocus(new FocusNode());
                          if(remark==''){
                            Fluttertoast.showToast(msg: '请输入完成情况');
                          }else{
                            showDialog(
                                barrierDismissible: false,
                                context: this.context,
                                builder: (BuildContext context) {
                                  return AlertDialog(
                                    title: Text('注意'),
                                    content: Text('确认拒绝吗？'),
                                    actions: <Widget>[
                                      new Container(
                                        child: FlatButton(
                                          child: new Text(
                                            "取消",
                                            style: TextStyle(color: Colors.black),
                                          ),
                                          onPressed: () {
                                            Navigator.pop(context);
                                          },
                                        ),
                                      ),
                                      new Container(
                                        child: FlatButton(
                                          child: new Text(
                                            "确定",
                                            style: TextStyle(color: Colors.red),
                                          ),
                                          onPressed: () {
                                            Navigator.pop(context);
                                            this.addImage('2');
                                          },
                                        ),
                                      ),
                                    ],
                                  );
                                });
                          }

                        },
                        child: Container(
                          height: Styles.MainButtonHeight,
                          alignment: Alignment.center,
                          child: Text('继续整改',
                              style: TextStyle(
                                  color: Styles.RedColor,
                                  fontSize: Styles.MainButtonTextFont)),
                        )),
                  ))
            ],
          ),
        ));
  }
}
